package com.team.controller;

import com.team.entity.Room;
import com.team.service.ScheduleService;
import com.team.util.Doctor;
import com.team.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/schedule")
public class ScheduleController {
    @Autowired
    private ScheduleService scheduleService;
    @RequestMapping("getDoctorBySign")
    @ResponseBody
    public Result<List<Doctor>> getDoctorBySign(Integer sign, Integer departmentId){
        List<Doctor> doctors = scheduleService.getDoctorBySign(sign,departmentId);
        if (doctors!=null){
            return new Result<>("1000","success",doctors);
        }else {
            return new Result<>("1001","该时间段没有医生");
        }
    }
    @RequestMapping("getRoom")
    @ResponseBody
    public Result<List<Room>> getRoom(Integer userId,Integer sign){
        List<Room> rooms =scheduleService.getRoomByDocIdAndSign(userId, sign);
        if (rooms!=null){
            return new Result<>("1000","success",rooms);
        }else{
            return new Result<>("1001","该时间段没有房间");
        }
    }
}
